Skip to content

Fix the flake8 warnings and make the lint check strict - #263

Merged
stefankoegl merged 1 commit into
claude/inspiring-turing-zftuu5from
claude/flake8-clean
Nov 11, 2026
Merged

stefankoegl merged 1 commit into
claude/inspiring-turing-zftuu5from
claude/flake8-clean

Conversation

@stefankoegl

Copy link
Copy Markdown
Owner

Stacked on #261 (base branch claude/inspiring-turing-zftuu5), because that PR already rewrites two places flake8 complained about: the runner at the end of tests.py and the tab in jsonpatch_cli.py. Merge #261 first; GitHub then retargets this PR to master.

CI ran flake8 twice: once for syntax errors and undefined names, and once with --exit-zero for everything else. About 270 style warnings, nearly all in tests.py and doc/conf.py, therefore never failed a build.

Changes

  • Fix all warnings, most of them with autopep8 (whitespace in brackets, blank lines, continuation-line indentation, #comment → # comment).
  • By hand: wrap the two 286-character lines in test_issue119, rename a variable l, and mark the two deliberate == None comparisons and the late import jsonpatch in doc/conf.py with # noqa.
  • CI: one strict flake8 . run instead of two.
  • New .flake8 with the line length of 127 that CI used, so local runs agree with CI.

One thing dropped

The old advisory run passed --max-complexity=10. Three functions exceed it: patch_files (24), AppendOperation._apply (12) and JsonPatch.apply (11). Splitting them up is not a style fix, so the strict check does not include the complexity limit.

Verification

  • Apart from whitespace and comments, the only code differences are the renamed variable, dropped u'' prefixes in test_issue119, and import sys, os split in two in doc/conf.py. Checked by comparing the syntax trees of the changed files before and after.
  • flake8 . reports 0; python tests.py (353 tests), pytest and sphinx-build -W pass on Python 3.13.

Generated by Claude Code

CI ran flake8 twice: once for syntax errors and undefined names, and once
with --exit-zero for everything else, so about 270 style warnings, nearly
all of them in tests.py and doc/conf.py, never failed a build. They are
fixed, most of them with autopep8, without changing what the code does.
Apart from whitespace and comments, the only changes are a renamed
variable and dropped u'' prefixes in two tests, and 'import sys, os'
split in two in doc/conf.py.

The check is now a single strict run, configured in .flake8 so that it
gives the same result locally. It no longer passes --max-complexity=10,
which three functions exceed (patch_files, AppendOperation._apply and
JsonPatch.apply): splitting them up is not a style fix.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PewzpjVeke4LTQ7Q88nyu6
@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage is 100.0% — claude/flake8-clean into claude/inspiring-turing-zftuu5. No base build found for claude/inspiring-turing-zftuu5.

@stefankoegl
stefankoegl merged commit 42c0338 into claude/inspiring-turing-zftuu5 Nov 11, 2026
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants